edderyouch commited on
Commit
64b3ff1
1 Parent(s): e2810e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -1,21 +1,19 @@
1
- import keras_nlp
2
- from keras_nlp.models import GemmaCausalLM
3
- import warnings
4
- warnings.filterwarnings('ignore')
5
- import os
6
 
7
-
8
-
9
- model = keras_nlp.models.CausalLM.from_preset(f"hf://soufyane/gemma_data_science")
10
 
11
  def process_text_gemma(input_text):
12
- response = model.generate(f"question: {input_text}", max_length=256)
 
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"],