Spaces:
Sleeping
Sleeping
Update model_api.py
Browse files- model_api.py +7 -10
model_api.py
CHANGED
|
@@ -6,20 +6,17 @@ def query_model(prompt):
|
|
| 6 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
client = InferenceClient(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
)
|
| 12 |
|
| 13 |
-
response = client.
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
{"role": "user", "content": prompt}
|
| 17 |
-
],
|
| 18 |
-
max_tokens=1500,
|
| 19 |
temperature=0.7
|
| 20 |
)
|
| 21 |
|
| 22 |
-
return response
|
| 23 |
|
| 24 |
except Exception as e:
|
| 25 |
return f"Error: {str(e)}"
|
|
|
|
| 6 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
client = InferenceClient(
|
| 9 |
+
model="google/flan-t5-large",
|
| 10 |
+
token=HF_TOKEN
|
| 11 |
+
)
|
| 12 |
|
| 13 |
+
response = client.text_generation(
|
| 14 |
+
prompt,
|
| 15 |
+
max_new_tokens=1200,
|
|
|
|
|
|
|
|
|
|
| 16 |
temperature=0.7
|
| 17 |
)
|
| 18 |
|
| 19 |
+
return response
|
| 20 |
|
| 21 |
except Exception as e:
|
| 22 |
return f"Error: {str(e)}"
|