paloma99 commited on
Commit
d8b3ee4
·
verified ·
1 Parent(s): e120d49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,20 +1,24 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- pipeline_hotdog = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
 
5
 
 
6
  chatbot_pipeline = pipeline(task="text-generation", model="microsoft/DialoGPT-medium")
7
 
8
- def predict(input_img,chat_input):
9
- hotdog_predictions = pipeline_hotdog(input_img)
10
- # Generate chatbot response
 
 
11
  chatbot_response = chatbot_pipeline(chat_input, max_length=50)[0]['generated_text']
12
 
13
  return input_img, {
14
  "Hotdog Classification": {p["label"]: p["score"] for p in hotdog_predictions},
15
  "Chatbot Response": chatbot_response
16
  }
17
-
18
  gradio_app = gr.Interface(
19
  fn=predict,
20
  inputs=[
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load the hotdog-not-hotdog model
5
+ hotdog_pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
6
 
7
+ # Load the chatbot model (DialoGPT)
8
  chatbot_pipeline = pipeline(task="text-generation", model="microsoft/DialoGPT-medium")
9
 
10
+ def predict(input_img, chat_input):
11
+ # Predict hotdog or not
12
+ hotdog_predictions = hotdog_pipeline(input_img)
13
+
14
+ # Generate chatbot response
15
  chatbot_response = chatbot_pipeline(chat_input, max_length=50)[0]['generated_text']
16
 
17
  return input_img, {
18
  "Hotdog Classification": {p["label"]: p["score"] for p in hotdog_predictions},
19
  "Chatbot Response": chatbot_response
20
  }
21
+
22
  gradio_app = gr.Interface(
23
  fn=predict,
24
  inputs=[