Spaces:
Runtime error
Runtime error
rsepulvedat
commited on
Commit
•
1f780ee
1
Parent(s):
6b277a8
initial commit
Browse files- app.py +21 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
pipe = pipeline("text-generation", model="gplsi/Aitana-6.3B", torch_dtype=torch.bfloat16, device_map="auto")
|
6 |
+
|
7 |
+
def predict(input_text):
|
8 |
+
generation = pipe(input_text, max_new_tokens=50, repetition_penalty=1.2, top_k=50, top_p=0.95, do_sample=True,
|
9 |
+
temperature=0.5, early_stopping=True, num_beams=2)
|
10 |
+
|
11 |
+
return generation[0]
|
12 |
+
|
13 |
+
gradio_app = gr.Interface(
|
14 |
+
predict,
|
15 |
+
inputs='text',
|
16 |
+
outputs='text',
|
17 |
+
title="Aitana-6.3B Text Generation",
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
gradio_app.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
datasets
|
3 |
+
torch
|