PegaMichael commited on
Commit
1135131
·
1 Parent(s): 690b30e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ #import os
3
+ #os.system("pip install transformers")
4
+ #from transformers import pipeline
5
+
6
+ # #ssl
7
+ # import ssl
8
+ # ssl._create_default_https_context = ssl._create_unverified_context
9
+
10
+
11
+ def generator_gpt2(text):
12
+ return text+"\n???"
13
+ def generator_openai_gpt(text):
14
+ return text+"\n!!!"
15
+
16
+ examples=[["Hello, I'm a language model,"],
17
+ ["How are you?\n"]]
18
+
19
+ demo1 = gr.Interface(fn=generator_gpt2,
20
+ inputs=gr.inputs.Textbox(label="input"),
21
+ outputs=gr.outputs.Textbox(label="???"),
22
+ )
23
+ demo2 = gr.Interface(fn=generator_openai_gpt,
24
+ inputs=gr.inputs.Textbox(),
25
+ outputs=gr.outputs.Textbox(label="!!!"),
26
+ )
27
+
28
+ demo = gr.Parallel(demo1, demo2,
29
+ examples=examples,
30
+ allow_flagging="auto",
31
+ css='styles.css',
32
+ )
33
+ demo.launch()
34
+ # demo.launch(server_name="0.0.0.0")