Spaces:
Sleeping
Sleeping
Update app.py
#1
by
edderyouch
- opened
app.py
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
-
import
|
2 |
-
from keras_nlp.models import GemmaCausalLM
|
3 |
-
import warnings
|
4 |
-
warnings.filterwarnings('ignore')
|
5 |
-
import os
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
def process_text_gemma(input_text):
|
12 |
-
|
|
|
13 |
return response
|
14 |
|
15 |
-
|
16 |
def main(input_text):
|
17 |
return process_text_gemma(input_text[0])
|
18 |
|
|
|
|
|
19 |
gr.Interface(
|
20 |
fn=main,
|
21 |
inputs=["text"],
|
|
|
1 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
# Load the model
|
4 |
+
model_name = "soufyane/gemma_data_science"
|
5 |
+
text_generator = pipeline("text-generation", model=model_name)
|
6 |
|
7 |
def process_text_gemma(input_text):
|
8 |
+
# Generate text using the model
|
9 |
+
response = text_generator(f"question: {input_text}", max_length=256)[0]['generated_text']
|
10 |
return response
|
11 |
|
|
|
12 |
def main(input_text):
|
13 |
return process_text_gemma(input_text[0])
|
14 |
|
15 |
+
import gradio as gr
|
16 |
+
|
17 |
gr.Interface(
|
18 |
fn=main,
|
19 |
inputs=["text"],
|