mibrahimzia's picture
Create app.py
cbc67b7 verified
raw
history blame
936 Bytes
import gradio as gr
from transformers import pipeline
# Load the model pipeline
generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")
# Define the function to generate proposal text
def generate_proposal(client_description):
prompt = f"Generate a professional project proposal based on the following client request:\n\n{client_description}\n\nProposal:"
result = generator(prompt, max_length=512, do_sample=True, temperature=0.7)
return result[0]['generated_text']
# Build the Gradio interface
iface = gr.Interface(
fn=generate_proposal,
inputs=gr.Textbox(label="Client Requirement", placeholder="Describe the project or client needs here...", lines=5),
outputs=gr.Textbox(label="Generated Proposal", lines=15),
title="AI Proposal Generator",
description="This app uses Mistral-7B to generate business proposals based on client input."
)
# Launch the app
iface.launch()