xp3857 commited on
Commit
b6eb1a4
1 Parent(s): 5c0f9d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -3
app.py CHANGED
@@ -1,9 +1,19 @@
1
  import gradio as gr
2
  import requests
3
  import os
 
 
 
 
 
4
 
5
  name = "andite/anything-v4.0"
6
  model = gr.Interface.load(f"models/{name}")
 
 
 
 
 
7
  o = os.getenv("P")
8
  h = "Q"
9
  def ac():
@@ -12,10 +22,27 @@ def ac():
12
  return model(put,negative_prompt = "blury")
13
  elif h != o:
14
  return(None)
 
 
 
 
 
 
 
 
 
 
 
15
  with gr.Blocks() as b:
16
  put = gr.Textbox()
17
- out = gr.Image()
18
- btn = gr.Button()
19
- btn.click(im_fn,put,out)
 
 
 
 
 
 
20
  b.queue(concurrency_count=100).launch()
21
  ac()
 
1
  import gradio as gr
2
  import requests
3
  import os
4
+ import gradio as gr
5
+ from transformers import pipeline
6
+
7
+
8
+
9
 
10
  name = "andite/anything-v4.0"
11
  model = gr.Interface.load(f"models/{name}")
12
+
13
+ pipe = pipeline(model=f"models/{name}")
14
+ pi = gr.Interface.from_pipeline(pipe)
15
+
16
+
17
  o = os.getenv("P")
18
  h = "Q"
19
  def ac():
 
22
  return model(put,negative_prompt = "blury")
23
  elif h != o:
24
  return(None)
25
+ def im_pipe(put):
26
+ return pi(put,negative_prompt = 'blury')
27
+ '''
28
+ num_images_per_prompt=n_images,
29
+ num_inference_steps = int(steps),
30
+ guidance_scale = guidance,
31
+ width = width,
32
+ height = height,
33
+ generator = generator,
34
+ callback=pipe_callback)
35
+ '''
36
  with gr.Blocks() as b:
37
  put = gr.Textbox()
38
+ with gr.Row():
39
+ out1 = gr.Image()
40
+ out2 = gr.Image()
41
+ with gr.Row():
42
+ btn1 = gr.Button()
43
+ btn2 = gr.Button()
44
+ btn1.click(im_fn,put,out1)
45
+ btn2.click(im_pipe,put,out2)
46
+
47
  b.queue(concurrency_count=100).launch()
48
  ac()