Spaces:
Runtime error
Runtime error
Jyotiyadav
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -31,13 +31,13 @@ From the given email, extract the following key values. The keys are explained b
|
|
31 |
|
32 |
|
33 |
# Define the function for generating output based on input
|
34 |
-
def generate_output(input_text):
|
35 |
# Prompt for the instruction
|
36 |
|
37 |
output = ""
|
38 |
# Initialize the FastLanguageModel
|
39 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
40 |
-
model_name =
|
41 |
max_seq_length = 2048,
|
42 |
dtype = None,
|
43 |
load_in_4bit = True,
|
@@ -62,9 +62,16 @@ def generate_output(input_text):
|
|
62 |
output = tokenizer.batch_decode(outputs)
|
63 |
return output
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
# Create Gradio interface
|
66 |
iface = gr.Interface(fn=generate_output,
|
67 |
-
inputs=
|
68 |
outputs="text",
|
69 |
title="Email Information Extraction",
|
70 |
description="Extract key information from the provided email.")
|
|
|
31 |
|
32 |
|
33 |
# Define the function for generating output based on input
|
34 |
+
def generate_output(input_text,model):
|
35 |
# Prompt for the instruction
|
36 |
|
37 |
output = ""
|
38 |
# Initialize the FastLanguageModel
|
39 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
40 |
+
model_name = model,
|
41 |
max_seq_length = 2048,
|
42 |
dtype = None,
|
43 |
load_in_4bit = True,
|
|
|
62 |
output = tokenizer.batch_decode(outputs)
|
63 |
return output
|
64 |
|
65 |
+
|
66 |
+
model_options = ["sxandie/llama_3_8b_4bitQ"]
|
67 |
+
inputs = [
|
68 |
+
gr.inputs.Textbox(label="Input Text"),
|
69 |
+
gr.inputs.Dropdown(label="Model", choices=model_options, default=model_options[0])
|
70 |
+
]
|
71 |
+
|
72 |
# Create Gradio interface
|
73 |
iface = gr.Interface(fn=generate_output,
|
74 |
+
inputs=inputs,
|
75 |
outputs="text",
|
76 |
title="Email Information Extraction",
|
77 |
description="Extract key information from the provided email.")
|