arnavg115 commited on
Commit
d84b073
·
1 Parent(s): 511eb93
Files changed (2) hide show
  1. app.py +12 -3
  2. requirements.txt +50 -1
app.py CHANGED
@@ -1,7 +1,16 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
 
4
+ tokenizer = AutoTokenizer.from_pretrained("Gorilla115/t5-shakespearify-lite")
 
5
 
6
+ model = AutoModelForSeq2SeqLM.from_pretrained("Gorilla115/t5-shakespearify-lite")
7
+
8
+ def Generate(text):
9
+ enc= tokenizer.encode("translate: "+text,return_tensors="pt")
10
+ out = model.generate(enc)
11
+ return tokenizer.decode(out[0]).replace("<pad>","").replace("</s>","")
12
+
13
+ # return "Hello " + name + "!!"
14
+
15
+ iface = gr.Interface(fn=Generate, inputs="text", outputs="text",examples=["Why have you come to Mr. Smith with this crap?","Who are you man?","You are in need of great care to fix this.","That’s true, and he asked me to beg both of you, your Majesties, to come and watch."])
16
  iface.launch()
requirements.txt CHANGED
@@ -1 +1,50 @@
1
- gradio
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.8.1
2
+ aiosignal==1.2.0
3
+ analytics-python==1.4.0
4
+ anyio==3.6.1
5
+ async-timeout==4.0.2
6
+ backoff==1.10.0
7
+ bcrypt==3.2.2
8
+ click==8.1.3
9
+ cycler==0.11.0
10
+ fastapi==0.79.1
11
+ ffmpy==0.3.0
12
+ fonttools==4.36.0
13
+ frozenlist==1.3.1
14
+ fsspec==2022.7.1
15
+ gradio==3.1.6
16
+ h11==0.12.0
17
+ httpcore==0.15.0
18
+ httpx==0.23.0
19
+ huggingface-hub==0.8.1
20
+ kiwisolver==1.4.4
21
+ linkify-it-py==1.0.3
22
+ markdown-it-py==2.1.0
23
+ matplotlib==3.5.3
24
+ mdit-py-plugins==0.3.0
25
+ mdurl==0.1.2
26
+ monotonic==1.6
27
+ multidict==6.0.2
28
+ numpy==1.23.2
29
+ orjson==3.7.12
30
+ pandas==1.4.3
31
+ paramiko==2.11.0
32
+ Pillow==9.2.0
33
+ pycryptodome==3.15.0
34
+ pydantic==1.9.2
35
+ pydub==0.25.1
36
+ PyNaCl==1.5.0
37
+ python-multipart==0.0.5
38
+ pytz==2022.2.1
39
+ regex==2022.8.17
40
+ rfc3986==1.5.0
41
+ sniffio==1.2.0
42
+ starlette==0.19.1
43
+ tokenizers==0.12.1
44
+ torch==1.12.1
45
+ tqdm==4.64.0
46
+ transformers==4.21.1
47
+ uc-micro-py==1.0.1
48
+ uvicorn==0.18.2
49
+ websockets==10.3
50
+ yarl==1.8.1