Spaces:
Runtime error
Runtime error
Update to use Inverence API with Qwen
Browse files
app.py
CHANGED
|
@@ -1,7 +1,17 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
def analyze_project(project_data, question):
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
def analyze_project(project_data, question):
|
| 5 |
+
api_key = os.getenv("HF_API_KEY")
|
| 6 |
+
client = InferenceClient(api_key=api_key)
|
| 7 |
+
|
| 8 |
+
prompt = f"Analyze this project: {project_data}\n\nQuestion: {question}"
|
| 9 |
+
inputs = client.encoding("text", prompt)
|
| 10 |
+
|
| 11 |
+
outputs = client.generate(
|
| 12 |
+
model="Qwen/Qwen2.5-72B-Instruct",
|
| 13 |
+
inputs=inputs,
|
| 14 |
+
max_new_tokens=100
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
return outputs["generated_text"][0]
|