Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ def mistral_inference(prompt, image_url):
|
|
| 39 |
# Gradio インターフェース
|
| 40 |
def process_input(text, image_url):
|
| 41 |
result = mistral_inference(text, image_url)
|
| 42 |
-
return result
|
| 43 |
|
| 44 |
with gr.Blocks() as demo:
|
| 45 |
gr.Markdown("## Pixtralモデルによる画像説明生成")
|
|
@@ -48,10 +48,12 @@ with gr.Blocks() as demo:
|
|
| 48 |
text_input = gr.Textbox(label="テキストプロンプト", placeholder="例: Describe the image.")
|
| 49 |
image_input = gr.Textbox(label="画像URL", placeholder="例: https://example.com/image.png")
|
| 50 |
|
| 51 |
-
result_output = gr.Textbox(label="モデルの出力結果")
|
| 52 |
-
|
|
|
|
| 53 |
submit_button = gr.Button("推論を実行")
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
demo.launch()
|
|
|
|
| 39 |
# Gradio インターフェース
|
| 40 |
def process_input(text, image_url):
|
| 41 |
result = mistral_inference(text, image_url)
|
| 42 |
+
return result, image_url
|
| 43 |
|
| 44 |
with gr.Blocks() as demo:
|
| 45 |
gr.Markdown("## Pixtralモデルによる画像説明生成")
|
|
|
|
| 48 |
text_input = gr.Textbox(label="テキストプロンプト", placeholder="例: Describe the image.")
|
| 49 |
image_input = gr.Textbox(label="画像URL", placeholder="例: https://example.com/image.png")
|
| 50 |
|
| 51 |
+
result_output = gr.Textbox(label="モデルの出力結果", lines=8, max_lines=20) # 高さを500ピクセルに相当するように調整
|
| 52 |
+
image_output = gr.Image(label="入力された画像", type="auto") # 入力画像URLを表示するための場所
|
| 53 |
+
|
| 54 |
submit_button = gr.Button("推論を実行")
|
| 55 |
+
|
| 56 |
+
# ボタンをクリックすると、モデルの結果と画像を表示
|
| 57 |
+
submit_button.click(process_input, inputs=[text_input, image_input], outputs=[result_output, image_output])
|
| 58 |
|
| 59 |
demo.launch()
|