Spaces:
Runtime error
Runtime error
Commit ·
32c2de5
1
Parent(s): 85ab98d
Update agent_t5.py
Browse files- agent_t5.py +0 -10
agent_t5.py
CHANGED
|
@@ -14,8 +14,6 @@ import os, time, torch
|
|
| 14 |
from torch.nn import Softmax
|
| 15 |
import requests
|
| 16 |
|
| 17 |
-
API_URL = "https://api-inference.huggingface.co/models/CreatorPhan/ViQA-small"
|
| 18 |
-
headers = {"Authorization": "Bearer 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"}
|
| 19 |
|
| 20 |
class Agent:
|
| 21 |
def __init__(self, args=None) -> None:
|
|
@@ -48,14 +46,6 @@ class Agent:
|
|
| 48 |
self.use_context = True
|
| 49 |
|
| 50 |
return f"Using file from {doc_path.name}"
|
| 51 |
-
|
| 52 |
-
def API_call(self, prompt):
|
| 53 |
-
response = requests.post(API_URL, headers=headers, json={"inputs": prompt}).json()
|
| 54 |
-
if isinstance(response, list):
|
| 55 |
-
return response[0]['generated_text']
|
| 56 |
-
else:
|
| 57 |
-
time.sleep(3)
|
| 58 |
-
return self.API_call(prompt)
|
| 59 |
|
| 60 |
def asking(self, question):
|
| 61 |
timestamp = datetime.now()
|
|
|
|
| 14 |
from torch.nn import Softmax
|
| 15 |
import requests
|
| 16 |
|
|
|
|
|
|
|
| 17 |
|
| 18 |
class Agent:
|
| 19 |
def __init__(self, args=None) -> None:
|
|
|
|
| 46 |
self.use_context = True
|
| 47 |
|
| 48 |
return f"Using file from {doc_path.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
def asking(self, question):
|
| 51 |
timestamp = datetime.now()
|