Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
text_generator = pipeline("text-generation", model=model_name)
|
6 |
|
7 |
def process_text_gemma(input_text):
|
8 |
-
|
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"],
|
@@ -21,4 +22,4 @@ gr.Interface(
|
|
21 |
title="Gemma Data Science Model",
|
22 |
description="This is a text-to-text model for data science tasks.",
|
23 |
live=True
|
24 |
-
).launch()
|
|
|
1 |
+
import keras_nlp
|
2 |
+
from keras_nlp.models import GemmaCausalLM
|
3 |
+
import warnings
|
4 |
+
warnings.filterwarnings('ignore')
|
5 |
+
import os
|
6 |
|
7 |
+
|
8 |
+
model = keras_nlp.models.CausalLM.from_preset(f"hf://soufyane/gemma_data_science")
|
|
|
9 |
|
10 |
def process_text_gemma(input_text):
|
11 |
+
response = model.generate(f"question: {input_text}", max_length=256)
|
|
|
12 |
return response
|
13 |
|
14 |
+
|
15 |
def main(input_text):
|
16 |
return process_text_gemma(input_text[0])
|
17 |
|
|
|
|
|
18 |
gr.Interface(
|
19 |
fn=main,
|
20 |
inputs=["text"],
|
|
|
22 |
title="Gemma Data Science Model",
|
23 |
description="This is a text-to-text model for data science tasks.",
|
24 |
live=True
|
25 |
+
).launch()
|