mehranandi commited on
Commit
90fa612
·
1 Parent(s): d86fd90

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -44
app.py DELETED
@@ -1,44 +0,0 @@
1
- import gradio as gr
2
- from transformers import AutoModelForSequennceGeneration
3
- import telebot
4
- import pytorch
5
-
6
- # Import the H4 model
7
- model = transformers.AutoModelForSequenceGeneration.from_pretrained("facebook/bart-base")
8
-
9
- # Define the gradio interface
10
- @gr.experimental.autograd()
11
- def generate(input_text):
12
- # Generate text
13
- generated_text = model.generate(
14
- input_text=input_text,
15
- max_length=100,
16
- )
17
-
18
- # Return the generated text
19
- return generated_text
20
-
21
- # Create the gradio interface
22
- app = gr.Interface(generate, inputs="text", outputs="text")
23
-
24
- # Run the gradio interface
25
- app.launch()
26
-
27
- # Define the Telegram bot
28
- bot = telebot.TeleBot(TOKEN)
29
-
30
- # Add a handler for the /generate command
31
- @bot.message_handler(commands=["generate"])
32
- def generate(message):
33
- # Get the input text
34
- input_text = message.text
35
-
36
- # Generate text
37
- generated_text = generate(input_text)
38
-
39
- # Send the generated text
40
- bot.send_message(message.chat.id, generated_text)
41
-
42
- # Start the bot
43
- bot.polling()
44
-