Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,13 +51,13 @@ def process_output(output):
|
|
| 51 |
|
| 52 |
|
| 53 |
# Define the function for generating output based on input
|
| 54 |
-
def generate_output(input_text):
|
| 55 |
# Prompt for the instruction
|
| 56 |
|
| 57 |
output = ""
|
| 58 |
# Initialize the FastLanguageModel
|
| 59 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 60 |
-
model_name =
|
| 61 |
max_seq_length = 2500,
|
| 62 |
dtype = None,
|
| 63 |
load_in_4bit = True,
|
|
@@ -108,20 +108,17 @@ examples = [
|
|
| 108 |
|
| 109 |
model_options = ["DataIntelligenceTeam/NER-Phi-3-mini-4k-instruct"]
|
| 110 |
#,"DataIntelligenceTeam/NER-gemma-7b-bnb-4bit","DataIntelligenceTeam/llama-3-8b-Instruct-bnb-4bit","DataIntelligenceTeam/mistral-7b-instruct-v0.2-bnb-4bit"]
|
| 111 |
-
inputs = [
|
| 112 |
-
gr.inputs.Textbox(label="Input Text"),
|
| 113 |
-
#gr.inputs.Dropdown(label="Select the Fine-tuned Model", choices=["DataIntelligenceTeam/NER-Phi-3-mini-4k-instruct","DataIntelligenceTeam/llama-3-8b-Instruct-bnb-4bit"]),
|
| 114 |
-
]
|
| 115 |
-
|
| 116 |
-
outputs = [
|
| 117 |
-
gr.outputs.Textbox(label="Original Output Text"),
|
| 118 |
-
gr.outputs.Textbox(label="Formatted JSON")
|
| 119 |
-
]
|
| 120 |
|
| 121 |
# Create Gradio interface
|
| 122 |
iface = gr.Interface(fn=generate_output,
|
| 123 |
-
inputs=
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
#examples=examples,
|
| 126 |
title="Email Information Extraction",
|
| 127 |
description="Extract key information from the provided email.")
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
# Define the function for generating output based on input
|
| 54 |
+
def generate_output(input_text,model):
|
| 55 |
# Prompt for the instruction
|
| 56 |
|
| 57 |
output = ""
|
| 58 |
# Initialize the FastLanguageModel
|
| 59 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 60 |
+
model_name = model,
|
| 61 |
max_seq_length = 2500,
|
| 62 |
dtype = None,
|
| 63 |
load_in_4bit = True,
|
|
|
|
| 108 |
|
| 109 |
model_options = ["DataIntelligenceTeam/NER-Phi-3-mini-4k-instruct"]
|
| 110 |
#,"DataIntelligenceTeam/NER-gemma-7b-bnb-4bit","DataIntelligenceTeam/llama-3-8b-Instruct-bnb-4bit","DataIntelligenceTeam/mistral-7b-instruct-v0.2-bnb-4bit"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
# Create Gradio interface
|
| 113 |
iface = gr.Interface(fn=generate_output,
|
| 114 |
+
inputs=[
|
| 115 |
+
gr.inputs.Textbox(label="Input Text"),
|
| 116 |
+
gr.inputs.Dropdown(label="Select the Fine-tuned Model", choices=["DataIntelligenceTeam/NER-Phi-3-mini-4k-instruct","DataIntelligenceTeam/llama-3-8b-Instruct-bnb-4bit"])
|
| 117 |
+
]
|
| 118 |
+
outputs= [
|
| 119 |
+
gr.outputs.Textbox(label="Original Output Text"),
|
| 120 |
+
gr.outputs.Textbox(label="Formatted JSON")
|
| 121 |
+
],
|
| 122 |
#examples=examples,
|
| 123 |
title="Email Information Extraction",
|
| 124 |
description="Extract key information from the provided email.")
|