Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,15 +36,12 @@ async def generate_response(request_body: RequestBody):
|
|
| 36 |
all_chunk = response.json()["choices"][0]["message"]["content"]
|
| 37 |
|
| 38 |
if model == 'bing':
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
except:
|
| 46 |
-
pass
|
| 47 |
-
|
| 48 |
if model == "cohere":
|
| 49 |
key_cohere = os.environ['key_cohere']
|
| 50 |
headers = {'accept': 'application/json','content-type': 'application/json','Authorization': f'Bearer {key_cohere}',}
|
|
|
|
| 36 |
all_chunk = response.json()["choices"][0]["message"]["content"]
|
| 37 |
|
| 38 |
if model == 'bing':
|
| 39 |
+
from g4f.client import Client
|
| 40 |
+
from g4f import Provider
|
| 41 |
+
client = Client()
|
| 42 |
+
response = client.chat.completions.create(model="gpt-4o", messages=[{"role": "user", "content": input_text}], provider=Provider.Bing)
|
| 43 |
+
all_chunk = response.choices[0].message.content
|
| 44 |
+
|
|
|
|
|
|
|
|
|
|
| 45 |
if model == "cohere":
|
| 46 |
key_cohere = os.environ['key_cohere']
|
| 47 |
headers = {'accept': 'application/json','content-type': 'application/json','Authorization': f'Bearer {key_cohere}',}
|