File size: 936 Bytes
cbc67b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|