lalashechka commited on
Commit
089f39e
1 Parent(s): d72c16e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -18
app.py CHANGED
@@ -112,24 +112,43 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
112
  result = client.predict(prompt,negative_prompt,"","",True,False,False,0,1024,1024,7,1,25,25,False,api_name="/run")
113
  return result
114
  except:
115
- ua = UserAgent()
116
- headers = {
117
- 'authority': 'radames-real-time-text-to-image-sdxl-lightning.hf.space',
118
- 'accept': 'text/event-stream',
119
- 'accept-language': 'ru,en;q=0.9,la;q=0.8,ja;q=0.7',
120
- 'cache-control': 'no-cache',
121
- 'referer': 'https://radames-real-time-text-to-image-sdxl-lightning.hf.space/?__theme=light',
122
- 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "YaBrowser";v="24.1", "Yowser";v="2.5"',
123
- 'sec-ch-ua-mobile': '?0',
124
- 'sec-ch-ua-platform': '"Windows"',
125
- 'sec-fetch-dest': 'empty',
126
- 'sec-fetch-mode': 'cors',
127
- 'sec-fetch-site': 'same-origin',
128
- 'user-agent': f'{ua.random}'
129
- }
130
- client = Client("radames/Real-Time-Text-to-Image-SDXL-Lightning", headers=headers)
131
- result = client.predict(prompt, [], 0, random.randint(1, 999999), fn_index=0)
132
- return result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
 
135
  def mirror(image_output, scale_by, method, gfpgan, codeformer):
 
112
  result = client.predict(prompt,negative_prompt,"","",True,False,False,0,1024,1024,7,1,25,25,False,api_name="/run")
113
  return result
114
  except:
115
+ try:
116
+ ua = UserAgent()
117
+ headers = {
118
+ 'authority': 'radames-real-time-text-to-image-sdxl-lightning.hf.space',
119
+ 'accept': 'text/event-stream',
120
+ 'accept-language': 'ru,en;q=0.9,la;q=0.8,ja;q=0.7',
121
+ 'cache-control': 'no-cache',
122
+ 'referer': 'https://radames-real-time-text-to-image-sdxl-lightning.hf.space/?__theme=light',
123
+ 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "YaBrowser";v="24.1", "Yowser";v="2.5"',
124
+ 'sec-ch-ua-mobile': '?0',
125
+ 'sec-ch-ua-platform': '"Windows"',
126
+ 'sec-fetch-dest': 'empty',
127
+ 'sec-fetch-mode': 'cors',
128
+ 'sec-fetch-site': 'same-origin',
129
+ 'user-agent': f'{ua.random}'
130
+ }
131
+ client = Client("radames/Real-Time-Text-to-Image-SDXL-Lightning", headers=headers)
132
+ result = client.predict(prompt, [], 0, random.randint(1, 999999), fn_index=0)
133
+ return result
134
+ except:
135
+ try:
136
+ ua = UserAgent()
137
+ headers = {
138
+ 'user-agent': f'{ua.random}'
139
+ }
140
+ client = Client("https://ashrafb-arpr.hf.space/", headers=headers)
141
+ result = client.predict(prompt, fn_index=0)
142
+ return result
143
+ except:
144
+ ua = UserAgent()
145
+ headers = {
146
+ 'user-agent': f'{ua.random}'
147
+ }
148
+ client = Client("https://ashrafb-arv3s.hf.space/", headers=headers)
149
+ result = client.predict(prompt,0,"Cinematic", fn_index=0)
150
+ return result
151
+
152
 
153
 
154
  def mirror(image_output, scale_by, method, gfpgan, codeformer):