Spaces:
Sleeping
Sleeping
feat: add
Browse files
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
demo.launch()
|
|
|
1 |
+
import spaces
|
2 |
+
import transformers
|
3 |
import gradio as gr
|
4 |
|
5 |
def greet(name):
|
6 |
return "Hello " + name + "!!"
|
7 |
|
8 |
+
|
9 |
+
@spaces.GPU
|
10 |
+
def infer():
|
11 |
+
from transformers import pipeline
|
12 |
+
|
13 |
+
messages = [
|
14 |
+
{"role": "user", "content": "Who are you?"},
|
15 |
+
]
|
16 |
+
pipe = pipeline("text-generation", model="microsoft/Phi-3-mini-4k-instruct", trust_remote_code=True)
|
17 |
+
return pipe(messages)
|
18 |
+
|
19 |
+
demo = gr.Interface(fn=infer, inputs="text", outputs="text")
|
20 |
demo.launch()
|