Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,17 @@ from io import BytesIO
|
|
| 9 |
from pydub import AudioSegment
|
| 10 |
import os
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Initialize components
|
| 13 |
translator = Translator()
|
| 14 |
qa_pipeline = pipeline("question-answering", model="distilbert-base-uncased")
|
|
|
|
| 9 |
from pydub import AudioSegment
|
| 10 |
import os
|
| 11 |
|
| 12 |
+
import httpx
|
| 13 |
+
|
| 14 |
+
async def fetch_data(url):
|
| 15 |
+
async with httpx.AsyncClient() as client:
|
| 16 |
+
response = await client.get(url)
|
| 17 |
+
return response.text # You can access the text after awaiting
|
| 18 |
+
|
| 19 |
+
# In your main chatbot code, you need to await the result when calling the fetch_data function:
|
| 20 |
+
response_text = await fetch_data("https://www.sbbusba.edu.pk/")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
# Initialize components
|
| 24 |
translator = Translator()
|
| 25 |
qa_pipeline = pipeline("question-answering", model="distilbert-base-uncased")
|