Unityraptor commited on
Commit
3b64339
1 Parent(s): c012fca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,16 +1,15 @@
1
- import streamlit as st
2
  from transformers import pipeline
3
 
4
- sentiment_pipeline = pipeline("sentiment-analysis")
5
 
6
- st.title("Sentiment Analysis with HuggingFace Spaces")
7
- st.write("Enter a sentence to analyze its sentiment:")
 
8
 
9
- user_input = st.text_input("")
10
- if user_input:
11
- result = sentiment_pipeline(user_input)
12
- sentiment = result[0]["label"]
13
- confidence = result[0]["score"]
14
-
15
- st.write(f"Sentiment: {sentiment}")
16
- st.write(f"Confidence: {confidence:.2f}")
 
1
+ import gradio as gr
2
  from transformers import pipeline
3
 
4
+ pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
5
 
6
+ def predict(image):
7
+ predictions = pipeline(image)
8
+ return {p["label"]: p["score"] for p in predictions}
9
 
10
+ gr.Interface(
11
+ predict,
12
+ inputs=gr.Image(label="Upload hot dog candidate", type="filepath"),
13
+ outputs=gr.Label(num_top_classes=2),
14
+ title="Hot Dog? Or Not?",
15
+ ).launch()