johann22 commited on
Commit
a10736f
β€’
1 Parent(s): e99a5b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -8,17 +8,17 @@ from models import models
8
  import urllib.request
9
  import uuid
10
  base_url="https://johann22-chat-diffusion.hf.space/"
11
- '''
12
  loaded_model=[]
13
  for i,model in enumerate(models):
14
  loaded_model.append(gr.load(f'models/{model}'))
15
  print (loaded_model)
16
- '''
17
  now = datetime.now()
18
  date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
19
 
20
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
21
- model = gr.load("models/stabilityai/sdxl-turbo")
22
  history = []
23
 
24
  def infer(txt):
@@ -66,7 +66,7 @@ def run(purpose,history,model_drop):
66
  out_prompt = f"An Error Occured generating the prompt \n {e}"
67
  yield ("",[(purpose,out_prompt)],None)
68
  try:
69
- #model=loaded_model[int(model_drop)]
70
  out_img=model(out_prompt)
71
  print(out_img)
72
  image=f'{base_url}file={out_img}'
@@ -101,4 +101,4 @@ with gr.Blocks() as iface:
101
  sub_b = submit_b.click(run, [msg,chatbot,model_drop],[msg,chatbot,sumbox])
102
  sub_e = msg.submit(run, [msg, chatbot,model_drop], [msg, chatbot,sumbox])
103
  stop_b.click(None,None,None, cancels=[sub_b,sub_e])
104
- iface.queue().launch(share=False,show_api=False)
 
8
  import urllib.request
9
  import uuid
10
  base_url="https://johann22-chat-diffusion.hf.space/"
11
+
12
  loaded_model=[]
13
  for i,model in enumerate(models):
14
  loaded_model.append(gr.load(f'models/{model}'))
15
  print (loaded_model)
16
+
17
  now = datetime.now()
18
  date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
19
 
20
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
21
+ #model = gr.load("models/stabilityai/sdxl-turbo")
22
  history = []
23
 
24
  def infer(txt):
 
66
  out_prompt = f"An Error Occured generating the prompt \n {e}"
67
  yield ("",[(purpose,out_prompt)],None)
68
  try:
69
+ model=loaded_model[int(model_drop)]
70
  out_img=model(out_prompt)
71
  print(out_img)
72
  image=f'{base_url}file={out_img}'
 
101
  sub_b = submit_b.click(run, [msg,chatbot,model_drop],[msg,chatbot,sumbox])
102
  sub_e = msg.submit(run, [msg, chatbot,model_drop], [msg, chatbot,sumbox])
103
  stop_b.click(None,None,None, cancels=[sub_b,sub_e])
104
+ iface.queue().launch(share=True,show_api=False)