Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
| 3 |
-
import tensorflow as tf
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# ๋ชจ๋ธ ์์ธก
|
| 15 |
-
prediction = model.predict(img).argmax()
|
| 16 |
-
return str(prediction)
|
| 17 |
-
|
| 18 |
-
# Gradio ์ธํฐํ์ด์ค ์ค์
|
| 19 |
-
iface = gr.Interface(fn=recognize_digit,
|
| 20 |
-
inputs=gr.inputs.Image(shape=(28,28), image_mode='L', invert_colors=True, source="canvas"),
|
| 21 |
-
outputs="text",
|
| 22 |
-
title="MNIST Digit Recognizer",
|
| 23 |
-
description="Draw a digit on the canvas and click 'Submit' to recognize it. Model trained on the MNIST dataset.")
|
| 24 |
-
# ์ธํฐํ์ด์ค ์คํ
|
| 25 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
|
|
|
| 3 |
|
| 4 |
+
# ๊ฐ์ ๋ถ์ ํ์ดํ๋ผ์ธ ์ด๊ธฐํ
|
| 5 |
+
sentiment_analysis = pipeline("sentiment-analysis")
|
| 6 |
|
| 7 |
+
def predict_sentiment(text):
|
| 8 |
+
result = sentiment_analysis(text)
|
| 9 |
+
return result[0]
|
| 10 |
|
| 11 |
+
# Gradio ์ธํฐํ์ด์ค ์ค์ ๋ฐ ์ฑ ์คํ
|
| 12 |
+
iface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text", title="Simple Sentiment Analysis")
|
| 13 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|