This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| al jawIllustrationSize = 220.dp | |
| val rightTeethGroup = listOf( | |
| ToothSpec( | |
| id = 1, | |
| drawable = Res.drawable.ic_teeth_01, | |
| angleDeg = 0f, | |
| ), | |
| ToothSpec( | |
| id = 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data class AnalyticsEvent( | |
| val name: String, | |
| val params: Map<String, Any?> = emptyMap() | |
| ) | |
| // Common abstraction | |
| interface AnalyticsService { | |
| fun logEvent(event: AnalyticsEvent) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| post("/summarize") { | |
| val textToSummarize = call.parameters["text"] ?: DefualtText | |
| val process = ProcessBuilder("../.venv/bin/python3", "../mlgate/main.py", textToSummarize) | |
| .redirectErrorStream(true) | |
| .start() | |
| val result = process.inputStream.bufferedReader().readText() | |
| call.respondText("Summary: $result") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from transformers import pipeline | |
| text = sys.argv[1] if len(sys.argv) > 1 else "" | |
| if text: | |
| summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| summary = summarizer(text, max_length=100, min_length=20, do_sample=False) | |
| print(summary[0]['summary_text']) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import FastAPI, Request | |
| from transformers import pipeline | |
| app = FastAPI() | |
| summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") | |
| @app.post("/summarize") | |
| async def summarize(request: Request): | |
| data = await request.json() |