philosopher-from-god commited on
Commit
9a28abc
·
verified ·
1 Parent(s): 77fcc73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -1,20 +1,11 @@
1
  # How to poop like a cat?
2
 
3
  import gradio as gr
 
4
  from transformers import pipeline
5
 
6
- pipeline = pipeline(task="image-classification", model="mistralai/Mistral-Nemo-Instruct-2407")
7
-
8
- def predict(input_img):
9
- predictions = pipeline(input_img)
10
- return input_img, {p["label"]: p["score"] for p in predictions}
11
-
12
- gradio_app = gr.Interface(
13
- predict,
14
- inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
15
- outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
16
- title="Hot Dog? Or Not?",
17
- )
18
-
19
- if __name__ == "__main__":
20
- gradio_app.launch()
 
1
  # How to poop like a cat?
2
 
3
  import gradio as gr
4
+ # Use a pipeline as a high-level helper
5
  from transformers import pipeline
6
 
7
+ pipe = pipeline("text-generation", model="mistralai/Mistral-Nemo-Instruct-2407")
8
+ messages = [
9
+ {"role": "user", "content": "Who are you?"},
10
+ ]
11
+ pipe(messages)