Canstralian commited on
Commit
60a3ae1
·
verified ·
1 Parent(s): 5b396f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -17
app.py CHANGED
@@ -1,22 +1,26 @@
1
- from transformers import AutoTokenizer, T5ForConditionalGeneration
2
 
3
- # Load your model and tokenizer
4
- tokenizer = AutoTokenizer.from_pretrained("t5-base")
5
- model = T5ForConditionalGeneration.from_pretrained("t5-base")
 
 
 
6
 
7
- # Modify the prompt to focus on blockchain security and secure devops
8
- prompt = "I am a neural network trained on the task of generating advice for improving blockchain security in secure development environments. Here are my recommendations: "
9
 
10
- # Increase max tokens for longer outputs
11
- max_length = 1024
12
-
13
- # Generate output with modified prompt
14
- generated_output = model.generate(
15
- prompt,
16
- max_length=max_length,
17
- num_return_sequences=1,
18
- return_dict_in_generate=True,
19
- temperature=0.7
20
  )
21
 
22
- print(generated_output)
 
 
 
 
 
1
+ import gradio as gr
2
 
3
+ # Define the sidebar items
4
+ sidebar_items = [
5
+ {"prompt": "Hello world!", "description": "A simple greeting."},
6
+ {"prompt": "What is your name?", "description": "Ask a user for their name."},
7
+ # Add more prompt examples and descriptions here...
8
+ ]
9
 
10
+ def greet(name):
11
+ return f"Hello {name}!"
12
 
13
+ # Create the interface with left sidebar
14
+ iface = gr.Interface(
15
+ fn=greet,
16
+ inputs="text",
17
+ outputs="text",
18
+ title="Greeting App",
19
+ description="Ask a user for their name and greet them."
 
 
 
20
  )
21
 
22
+ # Add the left sidebar with prompt examples
23
+ iface.sidebar(sidebar_items)
24
+
25
+ # Launch the Gradio app
26
+ iface.launch()