pr0mila commited on
Commit
49c2150
·
1 Parent(s): ec486db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -106,10 +106,34 @@ def ner_drugs(text):
106
  med_iface = gr.Interface(fn=ner_drugs,inputs = "text",outputs=["text"],title="Drugs Named Entity Recognition").queue()
107
 
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  demo = gr.TabbedInterface(
111
 
112
- [txtgen_iface, sum_iface, med_iface], ["Text Generation", "Summary Generation", "Drug Named-entity recognition"],
113
  title="All the Models of UWC",
114
 
115
  )
 
106
  med_iface = gr.Interface(fn=ner_drugs,inputs = "text",outputs=["text"],title="Drugs Named Entity Recognition").queue()
107
 
108
 
109
+ from diffusers import StableDiffusionPipeline
110
+
111
+ #pip install accelerate
112
+
113
+ #pip install --user
114
+
115
+ #pip install --user torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
116
+
117
+ pipe = StableDiffusionPipeline.from_pretrained('CompVis/stable-diffusion-v1-4')
118
+
119
+
120
+
121
+ # Initialize a prompt
122
+ def stable_image(text):
123
+ prompt = text
124
+ # Pass the prompt in the pipeline
125
+ return pipe(prompt).images[0]
126
+
127
+
128
+
129
+ import gradio as gr
130
+ stable_iface = gr.Interface(fn=stable_image, inputs= ["text"],outputs=gr.Image(type="pil"),title="Text To Image").queue()
131
+
132
+
133
 
134
  demo = gr.TabbedInterface(
135
 
136
+ [txtgen_iface, sum_iface, med_iface,stable_iface], ["Text Generation", "Summary Generation", "Drug Named-entity recognition","Text To Image"],
137
  title="All the Models of UWC",
138
 
139
  )