aixsatoshi commited on
Commit
45159cb
1 Parent(s): b29a047

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -75,21 +75,26 @@ def update_ui(language):
75
  labels = get_labels(language)
76
  return labels['title'], labels['text_prompt'], labels['image_url'], labels['output'], labels['image_display'], labels['submit']
77
 
 
 
 
78
  with gr.Blocks() as demo:
79
  language_choice = gr.Dropdown(choices=['en', 'zh', 'jp'], label="Select Language", value='en')
80
 
81
  title = gr.Markdown("## Pixtral Model Image Description")
82
  with gr.Row():
83
  text_input = gr.Textbox(label="Text Prompt", placeholder="e.g. Describe the image.")
84
- image_input = gr.Textbox(label="Image URL", placeholder="e.g. https://example.com/image.png")
85
 
 
86
  result_output = gr.Textbox(label="Model Output", lines=8, max_lines=20) # 高さ500ピクセルに相当するように調整
87
- image_output = gr.HTML(label="Input Image") # 入力画像URLを表示するための場所
88
 
89
  submit_button = gr.Button("Run Inference")
90
 
91
  submit_button.click(process_input, inputs=[text_input, image_input], outputs=[result_output, image_output])
92
 
 
93
  # 言語変更時にUIラベルを更新
94
  language_choice.change(
95
  fn=update_ui,
 
75
  labels = get_labels(language)
76
  return labels['title'], labels['text_prompt'], labels['image_url'], labels['output'], labels['image_display'], labels['submit']
77
 
78
+ # 初期URL
79
+ initial_url = "https://huggingface.co/spaces/aixsatoshi/Pixtral-12B/resolve/main/llamagiant.jpg"
80
+
81
  with gr.Blocks() as demo:
82
  language_choice = gr.Dropdown(choices=['en', 'zh', 'jp'], label="Select Language", value='en')
83
 
84
  title = gr.Markdown("## Pixtral Model Image Description")
85
  with gr.Row():
86
  text_input = gr.Textbox(label="Text Prompt", placeholder="e.g. Describe the image.")
87
+ image_input = gr.Textbox(label="Image URL", value=initial_url) # 初期URLを設定
88
 
89
+ # 初期画像を表示
90
  result_output = gr.Textbox(label="Model Output", lines=8, max_lines=20) # 高さ500ピクセルに相当するように調整
91
+ image_output = gr.HTML(f'<img src="{initial_url}" alt="Input Image" width="300">') # 入力された画像を最初から表示
92
 
93
  submit_button = gr.Button("Run Inference")
94
 
95
  submit_button.click(process_input, inputs=[text_input, image_input], outputs=[result_output, image_output])
96
 
97
+
98
  # 言語変更時にUIラベルを更新
99
  language_choice.change(
100
  fn=update_ui,