Spaces:
Runtime error
Runtime error
beratcmn
commited on
Commit
·
fb1c9eb
1
Parent(s):
ebce5cd
Added model
Browse files- .vscode/settings.json +6 -0
- app.py +15 -4
.vscode/settings.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"[python]": {
|
3 |
+
"editor.defaultFormatter": "ms-python.black-formatter"
|
4 |
+
},
|
5 |
+
"python.formatting.provider": "none"
|
6 |
+
}
|
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
generate_text = pipeline(
|
6 |
+
model="databricks/dolly-v2-12b",
|
7 |
+
torch_dtype=torch.bfloat16,
|
8 |
+
trust_remote_code=True,
|
9 |
+
device_map="auto",
|
10 |
+
)
|
11 |
|
12 |
+
|
13 |
+
def text_generation(prompt: str):
|
14 |
+
return generate_text(prompt)
|
15 |
+
|
16 |
+
|
17 |
+
iface = gr.Interface(fn=text_generation, inputs="text", outputs="text")
|
18 |
+
iface.launch()
|