@@ -23,15 +23,14 @@ import { GeneratingContext } from '../../context';
2323import ColorPalette from '../../colors' ;
2424import ProgressBar from '../../components/ProgressBar' ;
2525import { Ionicons } from '@expo/vector-icons' ;
26+ import { StatsBar } from '../../components/StatsBar' ;
2627
2728type TextToImageModelSources = TextToImageProps [ 'model' ] ;
2829
2930const MODELS : ModelOption < TextToImageModelSources > [ ] = [
3031 { label : 'BK-SDM 256' , value : BK_SDM_TINY_VPRED_256 } ,
3132 { label : 'BK-SDM 512' , value : BK_SDM_TINY_VPRED_512 } ,
3233] ;
33- import { BottomBarWithTextInput } from '../../components/BottomBarWithTextInput' ;
34- import { StatsBar } from '../../components/StatsBar' ;
3534
3635export default function TextToImageScreen ( ) {
3736 const [ inferenceStepIdx , setInferenceStepIdx ] = useState < number > ( 0 ) ;
@@ -42,8 +41,6 @@ export default function TextToImageScreen() {
4241 BK_SDM_TINY_VPRED_256
4342 ) ;
4443 const [ generationTime , setGenerationTime ] = useState < number | null > ( null ) ;
45- const [ showTextInput , setShowTextInput ] = useState ( false ) ;
46- const [ keyboardVisible , setKeyboardVisible ] = useState ( false ) ;
4744
4845 const imageSize = 224 ;
4946 const model = useTextToImage ( {
@@ -62,13 +59,11 @@ export default function TextToImageScreen() {
6259 try {
6360 const start = Date . now ( ) ;
6461 const output = await model . generate ( input , imageSize , steps ) ;
65- if ( output . length ) setImage ( output ) ;
66- else {
67- setImageTitle ( prevImageTitle ) ;
68- return ;
62+
63+ if ( output . length ) {
64+ setImage ( output ) ;
65+ setGenerationTime ( Date . now ( ) - start ) ;
6966 }
70- setGenerationTime ( Date . now ( ) - start ) ;
71- setImage ( output ) ;
7267 } catch ( e ) {
7368 console . error ( e ) ;
7469 } finally {
@@ -117,6 +112,7 @@ export default function TextToImageScreen() {
117112 onSelect = { ( m ) => {
118113 setSelectedModel ( m ) ;
119114 setImage ( null ) ;
115+ setGenerationTime ( null ) ;
120116 } }
121117 />
122118
@@ -136,6 +132,9 @@ export default function TextToImageScreen() {
136132 </ TouchableOpacity >
137133 </ View >
138134
135+ { /* Added StatsBar here, just above the input row */ }
136+ < StatsBar inferenceTime = { generationTime } />
137+
139138 < View style = { styles . inputRow } >
140139 < TextInput
141140 style = { styles . textInput }
@@ -146,20 +145,6 @@ export default function TextToImageScreen() {
146145 onSubmitEditing = { runForward }
147146 returnKeyType = "send"
148147 />
149- </ View >
150- < StatsBar inferenceTime = { generationTime } />
151- < View style = { styles . bottomContainer } >
152- < BottomBarWithTextInput
153- runModel = { runForward }
154- numSteps = { steps }
155- setSteps = { setSteps }
156- stopModel = { model . interrupt }
157- isGenerating = { model . isGenerating }
158- isReady = { model . isReady }
159- showTextInput = { showTextInput }
160- setShowTextInput = { setShowTextInput }
161- keyboardVisible = { keyboardVisible }
162- />
163148 { model . isGenerating ? (
164149 < TouchableOpacity
165150 style = { styles . sendButton }
0 commit comments