ctn8176 commited on
Commit
b99a30a
1 Parent(s): dd0962f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -83,14 +83,19 @@ def generate_response(prompt):
83
  output = model.generate(**model_inputs, **gen_conf)
84
 
85
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
86
- return f"Movie Info:\n{movie_info}\n\nGenerated Response:\n{generated_text}\nImage URL: {image_url}"
 
 
 
 
87
 
88
  # Define chat function for gr.ChatInterface
89
  def chat_function(message, history):
90
- response = generate_response(message)
91
  history.append([message, response])
92
- return response
93
 
94
  # Create Gradio Chat Interface
95
  chat_interface = gr.ChatInterface(chat_function)
96
  chat_interface.launch()
 
 
83
  output = model.generate(**model_inputs, **gen_conf)
84
 
85
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
86
+
87
+ # Display image directly in the chat
88
+ image_component = gr.Image(image_url, alt="Movie Poster")
89
+
90
+ return f"Movie Info:\n{movie_info}\n\nGenerated Response:\n{generated_text}\n", image_component
91
 
92
  # Define chat function for gr.ChatInterface
93
  def chat_function(message, history):
94
+ response, image_component = generate_response(message)
95
  history.append([message, response])
96
+ return response, image_component
97
 
98
  # Create Gradio Chat Interface
99
  chat_interface = gr.ChatInterface(chat_function)
100
  chat_interface.launch()
101
+