Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.14.0
metadata
title: StyleForge Lite
emoji: 🔬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
🔬 StyleForge Lite
A minimal Gradio app that learns your scientific writing style from pasted abstracts and rewrites new text in that style using the Groq API.
Features
- Style Learning: Paste 3-8 abstracts to build your writing profile
- Text Rewriting: Rewrite any text in your learned scientific style
- Style Metrics: Get detailed scoring on:
- Average sentence length
- Passive voice ratio
- Vocabulary match (% scientific verbs)
- Flow markers (context→method→result→implication)
- Total score (/20)
- Deployment Guide: Built-in instructions for Hugging Face Spaces
Quick Deploy to Hugging Face Spaces
Method 1: Direct Clone (Recommended)
Clone this repository:
git clone https://huggingface.co/spaces/Babajaan/Writing-Style cd Writing-StyleSet your API key:
- Go to your Space settings
- Add
GROQ_API_KEYas a secret with your Groq API key - Get your API key from Groq Console
Deploy: The Space will automatically rebuild with your changes
Method 2: Create New Space
Create new Space:
- Go to Hugging Face Spaces
- Click "Create new Space"
- Choose "Gradio" as SDK
- Set visibility (Public/Private)
Upload files:
- Upload
app.py - Upload
requirements.txt - Upload this
README.md
- Upload
Configure environment:
- Add
GROQ_API_KEYin Space settings → Secrets - Set Space hardware (CPU is sufficient)
- Add
Deploy: The Space will automatically build and deploy
Environment Variables
GROQ_API_KEY: Your Groq API key (required)
Requirements
- Python 3.8+
- Gradio >= 4.44.0
- Groq >= 0.9.0
Usage
- Paste Abstracts: Input 3-8 of your scientific abstracts in the first text box
- Enter Text: Input the text you want to rewrite in the second text box
- Click "Build Profile & Rewrite": The app will analyze your style and rewrite the text
- View Results: See the rewritten text and style metrics
Style Analysis
The app analyzes your writing style based on:
- Sentence Length: Optimal 15-25 words per sentence
- Voice: Preference for active over passive voice
- Vocabulary: Use of precise scientific verbs (identify, demonstrate, suggest, etc.)
- Flow: Logical progression from context → method → result → implication
Troubleshooting
- Build fails: Check
requirements.txtsyntax - API errors: Verify
GROQ_API_KEYis set correctly in Space secrets - Import errors: Ensure all dependencies are in
requirements.txt - Empty responses: Check your Groq API key and quota
Cost Considerations
- Groq API has generous free tier
- Monitor usage in Groq Console
- Consider rate limiting for production use
Example
Input Abstracts:
Resveratrol (RESL), a natural polyphenol, has been studied for its cancer chemopreventive properties. In this study, a diacetate derivative (RESL43) was synthesized, exhibiting potent cytotoxic and pro-apoptotic effects in U937 cells. Molecular docking indicated that RESL43 may inhibit NFκB by disrupting DNA–protein interactions. These findings support stronger activity than RESL and warrant further investigation.
Original Text:
Our study shows that the new drug works well. We tested it on cells and found good results. The drug might help treat cancer.
Rewritten Output:
Our investigation demonstrates that the novel therapeutic compound exhibits significant efficacy in cellular models. Through comprehensive in vitro analysis, we identified substantial cytotoxic activity and pro-apoptotic effects in U937 cell lines. These findings suggest the potential utility of this compound as a chemopreventive agent and warrant further investigation into its molecular mechanisms.
License
This project is open source and available under the MIT License.