cantuncok commited on
Commit
f660379
1 Parent(s): b1fd6cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -1,3 +1,28 @@
1
  import gradio as gr
 
 
2
 
3
- gr.load("models/meta-llama/Llama-3.2-90B-Vision-Instruct").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import AutoProcessor, AutoModelForCausalLM
3
+ import torch
4
 
5
+ # Model ve işlemciyi yükleyin
6
+ model_name = "meta-llama/Llama-3.2-90B-Vision-Instruct"
7
+ processor = AutoProcessor.from_pretrained(model_name)
8
+ model = AutoModelForCausalLM.from_pretrained(model_name)
9
+
10
+ def predict(image, text):
11
+ # Girdileri işleyin
12
+ inputs = processor(images=image, text=text, return_tensors="pt")
13
+ # Modelden yanıt alın
14
+ outputs = model.generate(**inputs)
15
+ # Çıktıyı çözümleyin
16
+ response = processor.decode(outputs[0], skip_special_tokens=True)
17
+ return response
18
+
19
+ # Gradio arayüzünü tanımlayın
20
+ interface = gr.Interface(
21
+ fn=predict,
22
+ inputs=["image", "text"],
23
+ outputs="text",
24
+ title="Llama 3.2 90B Vision Instruct Demo",
25
+ description="Bir görüntü ve metin girdisi alarak yanıt üreten model."
26
+ )
27
+
28
+ interface.launch()