Spaces:
Running
Running
Commit
·
bda7ad7
1
Parent(s):
6d5782e
chane chat completion
Browse files- .gradio/cached_examples/11/log.csv +3 -0
- app.py +4 -5
.gradio/cached_examples/11/log.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
Chatbot,timestamp
|
2 |
+
"[[""\u0a38\u0a24 \u0a38\u0a4d\u0a30\u0a40 \u0a05\u0a15\u0a3e\u0a32, \u0a24\u0a41\u0a38\u0a40\u0a02 \u0a15\u0a3f\u0a35\u0a47\u0a02 \u0a39\u0a4b?"", ""Error: InferenceClient.chat_completion() got an unexpected keyword argument 'max_new_tokens'\n\nThe model might not be properly configured for inference yet.""]]",2025-04-27 22:58:44.721847
|
3 |
+
"[[""Tell me about Punjab in a few sentences."", ""Error: InferenceClient.chat_completion() got an unexpected keyword argument 'max_new_tokens'\n\nThe model might not be properly configured for inference yet.""]]",2025-04-27 22:58:44.723935
|
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
-
import requests
|
4 |
|
5 |
# Use InferenceClient to interact with your model through the API
|
6 |
client = InferenceClient(model="modelsmafia/punjabi_Gemma-2B")
|
@@ -14,14 +13,14 @@ def chat_with_model(message, history):
|
|
14 |
messages.append({"role": "user", "content": message})
|
15 |
|
16 |
try:
|
17 |
-
# Generate response using Inference API
|
18 |
-
response = client.
|
19 |
-
|
20 |
max_new_tokens=512,
|
21 |
temperature=0.7,
|
22 |
top_p=0.9
|
23 |
)
|
24 |
-
return response
|
25 |
except Exception as e:
|
26 |
return f"Error: {str(e)}\n\nThe model might not be properly configured for inference yet."
|
27 |
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
|
4 |
# Use InferenceClient to interact with your model through the API
|
5 |
client = InferenceClient(model="modelsmafia/punjabi_Gemma-2B")
|
|
|
13 |
messages.append({"role": "user", "content": message})
|
14 |
|
15 |
try:
|
16 |
+
# Generate response using Inference API with correct parameters
|
17 |
+
response = client.text_generation(
|
18 |
+
prompt=message, # You might need to format this differently
|
19 |
max_new_tokens=512,
|
20 |
temperature=0.7,
|
21 |
top_p=0.9
|
22 |
)
|
23 |
+
return response
|
24 |
except Exception as e:
|
25 |
return f"Error: {str(e)}\n\nThe model might not be properly configured for inference yet."
|
26 |
|