Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,9 +12,12 @@ alpaca_prompt = """Below is an instruction that describes a task, paired with an
|
|
12 |
### Response:
|
13 |
{}"""
|
14 |
|
|
|
|
|
|
|
15 |
# Function to generate responses
|
16 |
@spaces.GPU
|
17 |
-
def generate_response(input_text
|
18 |
# Load the model and tokenizer within the GPU context
|
19 |
model = AutoPeftModelForCausalLM.from_pretrained(
|
20 |
"shakaryan/lebedev_qwen2.5",
|
@@ -45,19 +48,13 @@ with gr.Blocks() as demo:
|
|
45 |
placeholder="Enter the input text here...",
|
46 |
lines=5,
|
47 |
)
|
48 |
-
with gr.Row():
|
49 |
-
instruction_text = gr.Textbox(
|
50 |
-
label="Instruction Text",
|
51 |
-
value="You are a blogger named Artemiy Lebedev, your purpose is to generate a post in Russian based on the post article",
|
52 |
-
lines=3,
|
53 |
-
)
|
54 |
with gr.Row():
|
55 |
output = gr.Textbox(label="Generated Response", lines=10)
|
56 |
with gr.Row():
|
57 |
generate_button = gr.Button("Generate")
|
58 |
generate_button.click(
|
59 |
fn=generate_response,
|
60 |
-
inputs=[input_text
|
61 |
outputs=output
|
62 |
)
|
63 |
|
|
|
12 |
### Response:
|
13 |
{}"""
|
14 |
|
15 |
+
# Fixed instruction text
|
16 |
+
instruction_text = "You are a blogger named Artemiy Lebedev, your purpose is to generate a post in Russian based on the post article"
|
17 |
+
|
18 |
# Function to generate responses
|
19 |
@spaces.GPU
|
20 |
+
def generate_response(input_text):
|
21 |
# Load the model and tokenizer within the GPU context
|
22 |
model = AutoPeftModelForCausalLM.from_pretrained(
|
23 |
"shakaryan/lebedev_qwen2.5",
|
|
|
48 |
placeholder="Enter the input text here...",
|
49 |
lines=5,
|
50 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
with gr.Row():
|
52 |
output = gr.Textbox(label="Generated Response", lines=10)
|
53 |
with gr.Row():
|
54 |
generate_button = gr.Button("Generate")
|
55 |
generate_button.click(
|
56 |
fn=generate_response,
|
57 |
+
inputs=[input_text],
|
58 |
outputs=output
|
59 |
)
|
60 |
|