Spaces:
Runtime error
Runtime error
SanjayRohith
commited on
Commit
•
854be63
1
Parent(s):
a014197
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
title = "Text Generator"
|
6 |
+
description = "This text generator has been trained to chat and to respond to natural language instructions."
|
7 |
+
|
8 |
+
ans = pipeline(model="gpt2", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
9 |
+
|
10 |
+
def answer(query):
|
11 |
+
out = ans(query)
|
12 |
+
return out
|
13 |
+
|
14 |
+
Demo = gr.Interface(fn=answer, inputs='text', outputs='text', title=title, description=description)
|
15 |
+
Demo.launch()
|