Amitesh007 commited on
Commit
8993378
·
verified ·
1 Parent(s): c00a45b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,6 +1,10 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
 
 
 
4
  # Define the model and the text generation function
5
  fine_tuned_model = "Amitesh007/text_generation-finetuned-gpt2"
6
  generator = pipeline('text-generation', model=fine_tuned_model)
@@ -29,8 +33,8 @@ with gr.Blocks() as demo:
29
  inputs=input_text
30
  )
31
 
32
- generate_button.click(fn=generate, inputs=input_text, outputs=[output_text1, output_text2])
 
 
 
33
 
34
- # Launch the interface
35
- demo.queue(concurrency_count=2)
36
- demo.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Ensure the correct Keras package is used
5
+ import tensorflow as tf
6
+ import tf_keras
7
+
8
  # Define the model and the text generation function
9
  fine_tuned_model = "Amitesh007/text_generation-finetuned-gpt2"
10
  generator = pipeline('text-generation', model=fine_tuned_model)
 
33
  inputs=input_text
34
  )
35
 
36
+ generate_button.click(fn=generate, inputs=input_text, outputs=[output_text1, output_text2], concurrency_limit=2)
37
+
38
+ # Launch the interface with the max_threads parameter to control the total number of workers
39
+ demo.launch(max_threads=8)
40