ritwikbiswas commited on
Commit
8e3d888
1 Parent(s): 6b993b7

no stable diff no cuda

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio as gr
2
  import os
3
  import openai
4
- from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
5
- import torch
6
 
7
- model_id = "stabilityai/stable-diffusion-2-1"
8
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
- pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
10
  # pipe = pipe.to("cuda")
11
 
12
  openai.api_key = os.getenv("OPENAI_API_KEY")
@@ -32,14 +32,9 @@ def generate_prompt(radio,word1,word2):
32
  )['choices'][0]['text']
33
 
34
  response_txt = response.replace('\n','')
35
- diffusion_in = f'a dramatic painting of: {response_txt.split(".")[0]}'
36
- image = pipe(diffusion_in).images[0]
37
- return response_txt, image
38
-
39
- examples = [
40
- ["The Moon's orbit around Earth has"],
41
- ["The smooth Borealis basin in the Northern Hemisphere covers 40%"],
42
- ]
43
 
44
  demo = gr.Interface(
45
  generate_prompt,
 
1
  import gradio as gr
2
  import os
3
  import openai
4
+ # from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
5
+ # import torch
6
 
7
+ # model_id = "stabilityai/stable-diffusion-2-1"
8
+ # pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
+ # pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
10
  # pipe = pipe.to("cuda")
11
 
12
  openai.api_key = os.getenv("OPENAI_API_KEY")
 
32
  )['choices'][0]['text']
33
 
34
  response_txt = response.replace('\n','')
35
+ # diffusion_in = f'a dramatic painting of: {response_txt.split(".")[0]}'
36
+ # image = pipe(diffusion_in).images[0]
37
+ return response_txt#, image
 
 
 
 
 
38
 
39
  demo = gr.Interface(
40
  generate_prompt,