Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,29 @@
|
|
1 |
-
from huggingface_hub import InferenceClient
|
2 |
import gradio as gr
|
3 |
|
4 |
-
client = InferenceClient("""K00B404/BagOMistral_14X_Coders-ties-7B""")
|
|
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def format_prompt(message, history):
|
7 |
prompt = "<s>"
|
8 |
for user_prompt, bot_response in history:
|
@@ -47,5 +68,4 @@ demo = gr.ChatInterface(fn=generate,
|
|
47 |
)
|
48 |
|
49 |
demo.queue().launch(show_api=False)
|
50 |
-
|
51 |
-
#import app1
|
|
|
1 |
+
#from huggingface_hub import InferenceClient
|
2 |
import gradio as gr
|
3 |
|
4 |
+
#client = InferenceClient("""K00B404/BagOMistral_14X_Coders-ties-7B""")
|
5 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
6 |
+
import torch
|
7 |
|
8 |
+
# Replace 'your-username' and 'your-model-name' with your actual username and model name
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained('K00B404/BagOMistral_14X_Coders-ties-7B')
|
10 |
+
model = AutoModelForSequenceClassification.from_pretrained('K00B404/BagOMistral_14X_Coders-ties-7B')
|
11 |
+
|
12 |
+
# Example input sequence
|
13 |
+
input_sequence = "This is an example sentence."
|
14 |
+
|
15 |
+
# Tokenize the input sequence
|
16 |
+
inputs = tokenizer(input_sequence, return_tensors="pt")
|
17 |
+
|
18 |
+
# Run the input through the model
|
19 |
+
outputs = model(**inputs)
|
20 |
+
|
21 |
+
# Get the predicted class label
|
22 |
+
predicted_class = outputs[0].argmax(-1).item()
|
23 |
+
|
24 |
+
print("Predicted class:", predicted_class)
|
25 |
+
|
26 |
+
"""
|
27 |
def format_prompt(message, history):
|
28 |
prompt = "<s>"
|
29 |
for user_prompt, bot_response in history:
|
|
|
68 |
)
|
69 |
|
70 |
demo.queue().launch(show_api=False)
|
71 |
+
"""
|
|